package zjms_spring;

import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

public class Test1 {

	public static void main(String[] args) {
		ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		JmsTemplate template=(JmsTemplate)context.getBean("jmsTemplate");
		Destination dest=(Destination)context.getBean("queueDestination");
		template.send(dest,new MessageCreator() {
			public Message createMessage(Session session) throws JMSException {
				TextMessage msg=session.createTextMessage("abc");
				return msg;
			}
		});
		

	}

}
